{% extends "admin/change_list.html" %}
{% load adminmedia admin_list i18n %}

{% block extrastyle %}
  <style type="text/css">
    table {border-color: gray; width: 100%;}
    td:first-child {text-align: center;}
    td:last-child {white-space: normal; width: 99%;}
    td.th:first-child {border-left: none !important;}
    td.th {
    text-align: left;
    font-size: 12px;
    font-weight: bold;
    color: #666;
    padding: 2px 5px;
    font-size: 11px;
    background: #e1e1e1 url(../img/admin/nav-bg.gif) top left repeat-x;
    border-left: 1px solid gray;
    border-bottom: 1px solid gray;
    }
    td{
      white-space: nowrap;
      vertical-align: middle;
      border-left: 1px solid #ddd;
      border-bottom: 1px solid #ddd;
    }
  </style>
{% endblock extrastyle %}
{% block content %}
{% regroup forms by instance.app as forms%}
  <div id="content-main">
    <div class="module" id="changelist">
    {% if forms %}
    <form action='' method='post'>{% csrf_token %}
    <div class="results">
      <table cellspacing="0" id="result_list">
      <thead></thead>
      <tbody>
    {% for group in forms %}
      <tr><td colspan="4" style="padding: 0; margin: 0;"><h2>
      {% for form in group.list %}{% if form.instance.name == '_enable' %}{{form.value}}{% endif %}{% endfor %}
      {{group.grouper}}
      </h2></td></tr>
    {% if group.list|length > 1 or group.list.0.instance.name != '_enable' %}
      <tr><td class="th">Option</td><td class="th">Current Value</td><td class="th">Default Value</td><td class="th">Description</td></tr>
      {% for form in group.list %}
      {% if form.instance.name != '_enable' %}
      <tr class="{% cycle 'row1' 'row2' %}">
        <td>{{form.instance.get_name}}</td><td>{{form.value}}</td><td>{{form.instance.default}}</td><td>{{form.instance.description}}</td></tr>
      {% endif %}
      {% endfor %}
    {% endif %}
    {% endfor %}
      </tbody>
      </table>
    </div>
    <button type="submit" value="Save">Save</button>
    </form>
  {% endif %}
    </div>
  </div>
{% endblock %}
